<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>es6用法</title>
	<link rel="stylesheet" href="">
</head>
<body>
	<script type="text/javascript">
		//1.批量定义变量
		// let name = '张三',age = 20,sex = '男';	//old
		//let [name,age,sex] = ['张三',20,'男'];	//new

		//2.定义对象
		var obj = {name:'李四',age:30,sex:'女'};	//传统方法
		let {name,friends,pet} = {name:'李四',friends:['Lina','Jun'],pet:{name:'大宝',age:2}};	//解构赋值,键值对应,可以存放对象
		
		//3.定义嵌套数组
		let [arr1,[arr2,arr3,[arr4,arr5,arr6]]] = [1,[2,3,[4,5,6]]];

		//4.基本类型解构赋值
		let [a,b,c] = "你好吗";	//字符串类型可以进行对应的解构，数字不可
	</script>
</body>
</html>